//
//  YYSSheZhiController.m
//  FanLaiWu
//
//  Created by gonglei on 17/3/17.
//  Copyright © 2017年 yys. All rights reserved.
//

#import "YYSSheZhiController.h"

@interface YYSSheZhiController ()
@property (weak, nonatomic) IBOutlet UITextField *oldPasswordtext;

@property (weak, nonatomic) IBOutlet UITextField *text;
@property (weak, nonatomic) IBOutlet UITextField *aginText;


@end

@implementation YYSSheZhiController
- (IBAction)exitClickBtn:(id)sender {
   
    [[NSUserDefaults standardUserDefaults] setObject:@{} forKey:@"user_info"];
    [[NSUserDefaults standardUserDefaults] synchronize];
    [SVProgressHUD setMinimumDismissTimeInterval:1];
    [SVProgressHUD showSuccessWithStatus:@"退出成功"];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 40, 25)];
    [btn setTitle:@"保存" forState:UIControlStateNormal];
    [btn addTarget:self action:@selector(clickSave:) forControlEvents:UIControlEventTouchUpInside];
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:btn];
}
- (void)clickSave:(UIButton *)btn
{
    if (_oldPasswordtext.text.length <= 6) {
        
        [SVProgressHUD setMinimumDismissTimeInterval:1];
        [SVProgressHUD showErrorWithStatus:@"请输入正确密码（6到16位）"];
        return;
    }
    if (_text.text.length <= 6) {
        
        [SVProgressHUD setMinimumDismissTimeInterval:1];
        [SVProgressHUD showErrorWithStatus:@"请输入正确密码（6到16位）"];
        return;
    }
    if (_aginText.text.length <= 6) {
        
        [SVProgressHUD setMinimumDismissTimeInterval:1];
        [SVProgressHUD showErrorWithStatus:@"请输入正确密码（6到16位）"];
        return;
    }
    if ([_aginText.text isEqualToString:_text.text]) {
        [SVProgressHUD setMinimumDismissTimeInterval:1];
        [SVProgressHUD showErrorWithStatus:@"两次密码不一致"];
    }
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
